mini.parse();
var homeTree = [];
form=new mini.Form("form1")
function submit() {
    var data=form.getData();
    console.log(data);
}


// 接收父页面传过来的值的方法
function SetData(data){
    data = mini.clone(data);       //将父页面传过来的值深克隆一下
    console.log(data.folderTree,'树结构');
     homeTree = data.folderTree
    var folderComBox = mini.get("folderId")
    console.log(folderComBox,'qian')
    folderComBox.setData(homeTree);
    console.log(folderComBox,'hou')

}

function uploadFile() {

    var formdata = new FormData();
    console.log($('#fileId')[0]);

    formdata.append('file',$('#fileId')[0].files[0]);
    var data = form.getData();
   console.log(data)
   console.log(data.file)
    $.ajax({
        type: "POST",           //因为是传输文件，所以必须是post
        url: 'http://localhost:8080/DSMP/upload',
        //对应的后台处理类的地址
        mimeType:"multipart/form-data",
        data: formdata,
        datatype:"json",
        processData: false,
        contentType: false,
        success: function (data) {
            alert(data.msg);
        }
    });
}


//下拉框联动   当值改变时事件
function  onFolderChanged(e) {
    var folderCombo = mini.get("folderId")
    var folderSonCombo = mini.get("foldersonId")
    //获取根目录id
    var id = folderCombo.getValue();
    console.log(id)
    console.log(homeTree)
    //匹配根目录下的子文件夹
    for (var i = 0; i <homeTree.length ; i++) {
        if (homeTree[i].id == id){
            var sonFolder = homeTree[i].children;
            folderSonCombo.setData(sonFolder)
            folderSonCombo.select(0)
        }
    }
}




